<template>
	<view class="page" :style="'height:' + height + 'rpx'">
		<view style="width: 100%;">
			<view class="item" v-for="(item,index) in data" :key="index" @click="toDetails(item.xlsId)">
				<excelComponent :origiName="item.name"></excelComponent>
				<view class="type" v-if="item.status == 0" style="background-color: #EEAD0E">
					待确定
				</view>
				<view class="type" v-else-if="item.status == 1" style="background-color: #7CCD7C">
					已确定
				</view>
				<view class="type" v-else-if="item.status == 2" style="background-color: #23b8ff">
					已支付
				</view>
				<view class="type" v-else-if="item.status == 3" style="background-color: #EE5C42">
					被拒绝
				</view>
				<view class="shadow"></view>
			</view>
		</view>
		<view class="noDataTip" v-if="data.length == 0">
			<view class="iconfont icon-wuanpai" style="color:#6B6B6B;margin-right: 25rpx;font-size: 45rpx;"></view>
			<view style="font-size: 45rpx;">暂无创建数据!</view>
		</view>
	</view>
</template>

<script>
	import excelComponent from "../components/excelComponent/excelComponent.vue"
	export default {
		onLoad() {
			let that = this;
			uni.getSystemInfo({
				success: function(res) {
					let pxToRpxScale = 750 / res.windowWidth;
					that.height = res.windowHeight * pxToRpxScale;
				}
			})
			this.header.Authority = uni.getStorageSync('Authority');
			
		},
		onShow() {
			uni.showLoading({
				title: '加载中..',
				mask: true
				// mask: true
			})
			this.getMyCreated();
		},
		data() {
			return {
				height: 0,
				header: {},
				data: []
			}
		},
		methods: {
			async getMyCreated() {
				let res = await getApp().UniRequest("/timeoff/authority/getMyCreated", "Get", "",
					this.header);
				if (res.code === 20000) {
					this.data = res.data.data;
					// console.log(this.data);
					uni.hideLoading()
				}
				// console.log(res, '我创建的')
			},
			toDetails(xlsId) {
				// console.log(xlsId);
				uni.navigateTo({
					url: '../payMent/payMent?xlsId=' + xlsId
				})
			}
		},
		components: {
			excelComponent
		}
	}
</script>

<style lang="scss" scoped>
	$willSure: #EEAD0E; //待确定
	$sure: #90EE90; //已确定
	$payed: #23b8ff; //已支付
	$reject: #EE3B3B; //被拒绝

	.page {
		background-color: #f8f8f8;
		padding-top: 20rpx;
		
		.noDataTip {
			height: 150rpx;
			width: 650rpx;
			line-height: 50rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			position: absolute;
			top: 50%;
			margin-top: -150rpx;
			left: 50%;
			margin-left: -325rpx;
			font-size: 50rpx;
			color: #6B6B6B;
			// background-color: #fff;
			// box-shadow: 0.5rpx 0.5rpx 40rpx #DBDBDB;
			border-radius: 20rpx;
		}
		.item {
			width: 88%;

			position: relative;
			margin: 0 auto;
			margin-bottom: 20rpx;

			.type {
				position: absolute;
				right: -26rpx;
				top: 10rpx;
				background-color: #EEAD0E;
				color: #fff;
				width: 80rpx;
				height: 40rpx;
				line-height: 40rpx;
				text-align: center;
				font-size: 20rpx;
				letter-spacing: 2rpx;
			}

			.shadow {
				// z-index: ;
				position: absolute;
				right: -23rpx;
				top: 50rpx;
				// left: 20rpx;
				border: 12rpx solid #E0E0E0;
				border-right: 12rpx solid transparent;
				border-bottom: 12rpx solid transparent;
				width: 0;
				height: 0;
			}
		}
	}
</style>
